package com.buka.recipe.system.service;

import com.buka.recipe.system.entity.Department;
import org.springframework.data.domain.Page;

import java.util.List;

public interface DepartmentService {

    void save(Department department);

    void delete(Department department, Boolean confirm);

    Department getDepartmentById(Integer id);

    List<Department> getDepartmentsByIds(List<Integer> ids);

    Department getDepartmentByNameAndParentId(String name, int parentId);

    List<Department> getSubDepartmentsById(Integer id);

    Page<Department> getAll(Integer parentId, String name, Integer current, Integer pageSize);

    /**
     * 得到所有能操作的部门Id列表
     */
    List<Department> getAll();

    void updateAll(List<Department> departments);

    /**
     * 检查部门权限， 是否能操作
     * 只能操作当前用户的部门和子部门
     *
     * @param id 部门ID
     * @return 是否能操作
     */
    boolean checkDepartmentAuth(Integer id);

}
